<!--#include virtual="/dzps/p1.asp"-->
<!DOCTYPE html>
<html>
<head>
<title><%=val("webtitle")%></title>
<style type="text/css">
  input.layui-unselect{
      padding-left: 10px!important;
  }
</style>  
<%
	easp.include "h.asp"
%>
<script src="/dzps/yx/js/axios.min.js"></script>
</head>
<body>
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2><%=val("webtitle")%></h2>
        <p><%=val("website")%></p>
      </div>
	  
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
<%
  'echo selnolable(myopt("user_typ","用户类型",sql2arr("select id,name1 from baseinfo where mode='用户类型'"),0),"用户类型")
%>
		<div class="layui-form-item">
			  <div id="demo1"></div>
		</div>	
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-cellphone" for="LAY-user-login-cellphone"></label>
          <input type="text" id="userName" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>

        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="password" id="LAY-user-login-password" lay-verify="pass" placeholder="密码" class="layui-input">
        </div>
		<div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
          <input type="password" name="repass" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
        </div>
		
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-table" for="icon-table"></label>
          <input type="text" id="trueName" name="trueName" lay-verify="required" placeholder="真实姓名" class="layui-input">
        </div>		

        <div class="layui-form-item">
          <input type="checkbox" name="agreement" lay-skin="primary" lay-filter="agreement" title="同意会员权益书" checked>
        </div>
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-reg-submit" id="LAY-user-reg-submit">注 册</button>
        </div>
      </div>
    </div>
    <div class="layui-trans layadmin-user-login-footer">
      <p>© 2018 <a href="http://www./" target="_blank">xx.com</a></p>
      <!--
	  <p>
        <span><a href="http://www" target="_blank">获取授权</a></span>
        <span><a href="http://www" target="_blank">在线演示</a></span>
        <span><a href="http://www" target="_blank">前往官网</a></span>
      </p>
	  -->
    </div>
  </div>
  <script src="/dzps/src/layuiadmin/layui/layui.js"></script>  
  <script src="/dzps/src/xm-select.js"></script>

  <script>
  layui.config({
    base: '/dzps/src/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'user'], function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form;
    form.render();
	function aa(){
		layer.alert('欢迎您！', {
			skin: 'layui-layer-molv' 
		  ,closeBtn: 0,time: 0
		  ,title:'在线C练习系统'
		});
	}
  	var demo1 = xmSelect.render({
		el: '#demo1', 
		name:'user_typ',
		paging: true,
	  pageSize: 10,		
		pageRemote: true,
		autoRow: true,
		radio: true,
		clickClose: true,
		//toolbar: { show: true },
		filterable: true,
		remoteSearch: true,
		prop: {
      name: 'name1',
      value: 'id',
	  },
	model: {
		label: {
			type: 'text',
			text: {
				separator: ', ',
			},
		}
	},
		remoteMethod: function(val, cb, show,pageIndex){
			if(!val){//这里如果val为空, 则不触发搜索
				//return cb([]);
			}
			axios({
				method: 'get',
				url:'/dzps/src/views/xxk/pjson.asp?action=prn_l2&limit=10',
				params: {
				page:  pageIndex,					
				keyword: val,
			}
			}).then(response => {
				var res = response.data;
				var count= response.data.count;
				cb(res.data,Math.ceil(count/10))
			}).catch(err => {
				cb([]);
			});
		},
	})
form.on('checkbox(agreement)', function(data){
  if(data.elem.checked){
	  aa();
  }
}); 	
form.on('submit(LAY-user-reg-submit)', function(obj){
  var field = obj.field;
  if(field.password !== field.repass){
	  return layer.msg('两次密码输入不一致');
  }
  if(!field.agreement){
	  return layer.msg('你必须同意用户协议才能注册');
  }
  admin.req({
	url: layui.setter.base + 'lib/reg.asp?action=userReg' 
	,data: field
	,done: function(res){
		if(res.msg=='成功'){
			layer.msg(res.msg, {offset: '15px',icon: 1,time: 1000}, function(){
			location.href = 'login.asp'; 
		  });	
		}else{
			layer.msg(res.msg, {offset: '15px',icon: 1,time: 1000}, function(){
		  });			
		}
	}
  });
  return false;
});
});
  </script>
</body>
</html>